home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 June: Reference Library / Dev.CD Jun 00 RL Disk 1.toast / pc / technical documentation / develop / develop issue 26 / develop issue 26 code / mpw tips and tricks - pascaltoc / c.pascal scripts / pascaltoc < prev    next >
Encoding:
Text File  |  1996-03-28  |  1.2 KB  |  45 lines

  1. set plainInt short    # use long with MPW C
  2.  
  3. set exit 0
  4. for f in {"parameters"}
  5.     target "{f}"
  6.     subword procedure void
  7.     subword integer "short"
  8.     subword longint "long"
  9.     subword var ""
  10.     subword function ""
  11.     substitute '([a-zA-Z_0-9]+)®1[ ∂t∂n]*∂=[ ∂t∂n]*record' 'struct ®1 ¥START¥'
  12.     substitute  '^.' '->'
  13.     substitute '([a-zA-Z_0-9]+)®1∂^' '*®1'
  14.     substitute '∂:=' '¥ASSIGN¥'
  15.     substitute '<>' '¥NOTEQUAL¥'
  16.     substitute '>=' '¥GREATEREQUAL¥'
  17.     substitute '<=' '¥LESSEQUAL¥'
  18.     substitute '=' '¥EQUALS¥'
  19.     substitute '¥EQUALS¥' '=='
  20.     substitute '¥NOTEQUAL¥' '!='
  21.     substitute '¥GREATEREQUAL¥' '>='
  22.     substitute '¥LESSEQUAL¥' '<='
  23.     substitute '¥ASSIGN¥' '='
  24.     substitute '([a-zA-Z_0-9]+)®1[ ∂t∂n]*∂:[ ∂t∂n]*([a-zA-Z_0-9]+)®2' '®2 ®1'
  25.     find •
  26.     replace -c ∞ '/[¬a-zA-Z_0-9]if[ ∂t∂n]+(≈)®1[ ∂t∂n]+then/' 'if (®1)'
  27.     find •
  28.     replace -c ∞ '/[¬a-zA-Z_0-9]while[ ∂t∂n]+(≈)®1[ ∂t∂n]+{/' 'while (®1) ¥START¥'
  29.     find •
  30.     replace -c ∞ '/[¬a-zA-Z_0-9]case[ ∂t∂n]+(≈)®1[ ∂t∂n]+of/' 'switch (®1)'
  31.     subword elseif "else if"
  32.     subword begin '¥START¥'
  33.     subword end '¥FINISH¥'
  34.     #substitute '∂(∂*' '/*'
  35.     #substitute '∂*∂)' '*/'
  36.     substitute '{' '∂/∂*'
  37.     substitute '}' '∂*∂/'
  38.     substitute '¥START¥' '{'
  39.     substitute '¥FINISH¥' '}'
  40.     substitute '};' '}'
  41.     #save "{target}"
  42.     #close "{target}"
  43. end
  44. set exit 1
  45.